<div class="panel panel-default panel-intro">{:build_heading()}
    <div class="panel-body">
        <div id="myTabContent" class="tab-content">
            <div class="tab-pane fade active in" id="one">
                <div class="widget-body no-padding">
                    <div class="bootstrap-table">
                        <div class="fixed-table-toolbar search-form">
                            <div class="bs-bars pull-left">
                                <div id="toolbar" class="toolbar" style="position: relative;">
                                    <a href="javascript:;" class="btn btn-primary btn-refresh" title="刷新">
                                        <i class="fa fa-refresh"></i>
                                    </a>
                                    <a href="{:url('Ziyuan/zedit')}" class="btn btn-success btn-add" title="添加">
                                        <i class="fa fa-plus"></i>添加</a>
                                </div>
                            </div>
                            <div class="columns-right pull-right" style="margin-top:10px;margin-bottom:10px;">
                                <button class="btn btn-default" type="button" name="commonSearch" id="search" title="普通搜索">
                                    <i class="glyphicon glyphicon-search"></i>
                                </button>
                            </div>

                            <div class="pull-right search">
                                <select class="group form-control" style="min-width: 100px;" name="cate">
                                    {volist name="cates" id="cate"}
                                     <option value="{$cate['id']}" {if condition="(!empty($data)) AND $cate['id'] eq $cate"}selected{/if}>{$cate.name}</option>
                                    {/volist}
                                </select>
                            </div>      
                            <div class="pull-right search" style="line-height: 31px;margin-left: 15px;margin-right: 10px;">
                                资源分类:
                            </div>

                            <div class="pull-right search">
                                <select class="group form-control" name="home_admin" style="min-width: 100px;">
                                    <option value="0">请选择</option>
                                    <option value="1">前台</option>
                                    <option value="2">后台</option>
                                </select>
                            </div>      
                            <div class="pull-right search" style="line-height: 31px;margin-left: 15px;margin-right: 10px;">
                                前后台:
                            </div>
                        </div>
                        <div class="fixed-table-container" style="padding-bottom: 0px;">
                            <div class="fixed-table-body">
                                <table id="table" class="table table-striped table-bordered table-hover" width="100%">
                                    <thead>
                                        <tr>
                                            <th style="text-align: center; vertical-align: middle; ">
                                                <div class="th-inner ">编号</div>
                                                <div class="fht-cell"></div>
                                            </th>
                                            <th style="text-align: center; vertical-align: middle; ">
                                                <div class="th-inner ">前后台 </div>
                                                <div class="fht-cell"></div>
                                            </th>
                                            <th style="text-align: center; vertical-align: middle; ">
                                                <div class="th-inner ">资源分类</div>
                                                <div class="fht-cell"></div>
                                            </th>
                                            <th style="text-align: center; vertical-align: middle; ">
                                                <div class="th-inner ">分类所属</div>
                                                <div class="fht-cell"></div>
                                            </th>
                                            <th style="text-align: center; vertical-align: middle; ">
                                                <div class="th-inner ">资源类型</div>
                                                <div class="fht-cell"></div>
                                            </th>
                                          <th style="text-align: center; vertical-align: middle; ">
                                                <div class="th-inner ">状态</div>
                                                <div class="fht-cell"></div>
                                            </th>
                                            <th style="text-align: center; vertical-align: middle; ">
                                                <div class="th-inner ">操作</div>
                                                <div class="fht-cell"></div>
                                            </th>
                                        </tr>
                                    </thead>
                                    <tbody data-listidx="0">
                                      {volist name="list" id="vo"}
                                        {php}
                                          $cate=db('resource_cate')->where('id', $vo['cate'])->find();
                                          $model=db('model_manage')->where('id', $vo['model'])->find();
                                          $attr=db('resource_attr')->where('id', $vo['attr'])->find();
                                        {/php}
                                        <tr data-index="0">
                                            <td style="text-align: center; vertical-align: middle;">
                                               {$vo.id}
                                            </td>
                                            <td style="text-align: center; vertical-align: middle;">
                                                {if condition="$vo['home_admin'] eq 1"}
                                                  前台
                                                {elseif condition="$vo['home_admin'] eq 2"/}
                                                 后台
                                                {else/}
                                                  无
                                                {/if}
                                            </td>
                                            <td style="text-align: center; vertical-align: middle;">
                                                {$cate.name}
                                            </td>
                                            <td style="text-align: center; vertical-align: middle;">
                                                {$model.name}模块
                                            </td>
                                            <td style="text-align: center; vertical-align: middle;">
                                                {$attr.name}
                                            </td>
                                          <td style="text-align: center; vertical-align: middle;">
                                              {if condition="$vo['status'] eq 1"}
                                                上线
                                              {else/}
                                                下线
                                              {/if}
                                            </td>
                                            <td style="text-align: center; vertical-align: middle;">
                                                {if condition="$vo['status'] eq 1"}
                                                  <a href="{:url('Ziyuan/changeStatus',['id'=>$vo['id'],'status'=>0])}" class="btn btn-xs btn-success">
                                                    下线
                                                  </a>
                                                {else/}
                                                  <a href="{:url('Ziyuan/changeStatus',['id'=>$vo['id'],'status'=>1])}" class="btn btn-xs btn-success">
                                                    上线
                                                  </a>
                                                {/if}
                                                <a href="{:url('Ziyuan/resourcefilelist',['id'=>$vo['id']])}" class="btn btn-xs btn-success">
                                                    查看
                                                </a>
                                                <a href="{:url('Ziyuan/zedit',['id'=>$vo['id']])}" class="btn btn-xs btn-success">
                                                    修改
                                                </a>
                                                <a href="{:url('Ziyuan/zdelete',['id'=>$vo['id']])}" class="btn btn-xs btn-danger">
                                                    删除
                                                </a>
                                            </td>
                                        </tr>
                                      {/volist}
                                    </tbody>
                                </table>
                            </div>
                            <div class="fixed-table-pagination" style="display: block;">
                                {$list->render()}
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript">

    //搜索功能
    $("#search").click(function(){
        var url ="{:url('zlist')}";

        var query  = $('.search-form').find('select').serialize();

        if( url.indexOf('?')>0 ){

            url += '&' + query;

        }else{
            url += '?' + query;
        }
        window.location.href = url;

    });


</script>